Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

181
Views
Have this code so when a user presses the up or down key the balloon grows or shrinks. Need balloon to burst to "💥" when it reaches font size over 70

So far the balloon should only be able to reach max 70 font before it bursts. I need to turn the balloon into "๐Ÿ’ฅ". The event listener needs to be removed when the balloon bursts.

let para = document.querySelector('p');
para.style.fontSize = '24px';

window.addEventListener("keydown", e => {
  var sizeAsInteger = parseInt(para.style.fontSize, 10);

  if (e.key == "ArrowUp") {
    sizeAsInteger += 10;
  } else {
    sizeAsInteger -= 10;
  }

  para.style.fontSize = sizeAsInteger + 'px';
});
p {
  font-size: 50px;
}
<body>
  <p>๐ŸŽˆ</p>
</body>

about 4 years ago ยท Juan Pablo Isaza
1 answers
Answer question

0

Is this what you want?

let para = document.querySelector("p");

para.style.fontSize = "24px";

const increaseSize = e => {
  var sizeAsInteger = parseInt(para.style.fontSize, 10);

  if (sizeAsInteger >= 70) {
    window.removeEventListener("keydown", increaseSize);
    return (para.innerHTML = "๐Ÿ’ฅ");
  }

  if (e.key == "ArrowUp") {
    sizeAsInteger += 10;
  } else {
    sizeAsInteger -= 10;
  }

  para.style.fontSize = sizeAsInteger + "px";
};

window.addEventListener("keydown", increaseSize);
p {
  font-size: 50px;
}
<p>๐ŸŽˆ</p>

about 4 years ago ยท Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
ยฉ 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!